/*
 * mox_flasher.h
 *
 *  Created on: Jun 14, 2010
 *      Author: Jason Monk
 */

#ifndef MOX_FLASHER_H_
#define MOX_FLASHER_H_
#include "module_uart.h"
#include "perl_out.h"

#define CLEAR 1
#define DB_SECT 4
#define DB_ADDR 0x40000
#define DB_OFFSET 0x400
#define FN_SECT 5
#define FN_ADDR 0x50000

struct mox_flash_entry {
	char name[8];
#ifndef __XC__
	int *addr[NUM_CORES];
#else
	int addr[NUM_CORES];
#endif
	int offset[NUM_CORES];
	int size;
	int stack_size[NUM_CORES];
	int const_offset[NUM_CORES];
	int data_offset[NUM_CORES];
};

#define FLASH_SIG		(0x80)
#define FLASH_GET_FUNC	(0x81)
#define FLASH_ACK		(0x82)
#define FLASH_NACK		(0x83)

#include <mox.h>

#ifndef __XC__
void flasher_master(mox_master_state *state);
void flasher_slave(struct mox_slave_state *state);
void flash_func(mox_master_state *state, struct mox_flash_entry *flasher,
		void *func_space, struct mox_module *storage);
#endif

#endif /* MOX_FLASHER_H_ */
